var contentUrl = root + "cms/address/findAddressNEStatusPage";
var editUrl = 'addressEdit.jsp?id=';
var operateUrl = root + 'cms/address/operateAddressByIds';
$(document).ready(function(){
	dipscontent(getfilter(),contentUrl);
	//点击查询按钮
	$("#search_btn").click(function(){
		dipscontent(getfilter(),contentUrl,config.nextPage,config.pageSize,1);
	});
	//点击新增按钮
	$("#addSome").click(function(){
		location.href = editUrl + 0;
	});
	//点击修改按钮
	$('#mycontent').on('click','#edit_btn',function(){
		var from = window.location.href.split("?")[0] + "?nextPage=" + (parseInt($("#_click_page").val())+1);
		location.href = editUrl + $(this).attr('data-id') + '&from=' + from;
	});
	//删除事件
	$('#mycontent').on('click','.delete_btn',function(){
        del(this,operateUrl + '?modelIds=',$(this).attr('data-id'));
	});
	//点击批量删除按钮
	$('#batchDelete_btn').click(function(){
		del(this,operateUrl + '?modelIds=');
	});
	//发布按钮
	$('#mycontent').on('click','#publish_btn',function(){
		publish(this,operateUrl,$(this).attr('data-id'));
	});
	//批量发布
	$('#batchPub_btn').click(function(){
		publish(this,operateUrl);
	});
	//撤消按钮
	$('#mycontent').on('click','#unpublish_btn',function(){
		unpublish(this,operateUrl,$(this).attr('data-id'));
	});
	//批量撤消
	$('#batchUnPub_btn').click(function(){
		unpublish(this,operateUrl);
	});
});
function getfilter(){
	var _jsonFilter = "{";
		if($("#search_consigneeName").val() && $("#search_consigneeName").val().length > 0){
		_jsonFilter += "'search_EQ_consigneeName':'"+replaceSingleQuote($("#search_consigneeName").val())+"',";
	}
		if($("#search_mobile").val() && $("#search_mobile").val().length > 0){
		_jsonFilter += "'search_EQ_mobile':'"+replaceSingleQuote($("#search_mobile").val())+"',";
	}
		if($("#search_Province").val() && $("#search_Province").val().length > 0){
		_jsonFilter += "'search_EQ_Province':'"+replaceSingleQuote($("#search_Province").val())+"',";
	}
		if($("#search_city").val() && $("#search_city").val().length > 0){
		_jsonFilter += "'search_EQ_city':'"+replaceSingleQuote($("#search_city").val())+"',";
	}
		if($("#search_area").val() && $("#search_area").val().length > 0){
		_jsonFilter += "'search_EQ_area':'"+replaceSingleQuote($("#search_area").val())+"',";
	}
		if($("#search_detailAddress").val() && $("#search_detailAddress").val().length > 0){
		_jsonFilter += "'search_EQ_detailAddress':'"+replaceSingleQuote($("#search_detailAddress").val())+"',";
	}
		if($("#search_userId").val() && $("#search_userId").val().length > 0){
		_jsonFilter += "'search_EQ_userId':'"+replaceSingleQuote($("#search_userId").val())+"',";
	}
		if($("#search_isDefault").val() && $("#search_isDefault").val().length > 0){
		_jsonFilter += "'search_EQ_isDefault':'"+replaceSingleQuote($("#search_isDefault").val())+"',";
	}
		if($("#search_postcode").val() && $("#search_postcode").val().length > 0){
		_jsonFilter += "'search_EQ_postcode':'"+replaceSingleQuote($("#search_postcode").val())+"',";
	}
		if(_jsonFilter != "{"){
		_jsonFilter = _jsonFilter.substring(0,_jsonFilter.length - 1);
	}
	_jsonFilter += "}";
	return _jsonFilter;
}